/*******************************************************************************
 * SVN­Versioning-Information:
 * ­­­­­­­­­­­­­­­­­­­­­­­­
 * $LastChangedRevision: 132 $
 * $LastChangedBy: MV $
 * $LastChangedDate: 2009-06-24 23:19:17 +0200 (Wed, 24 Jun 2009) $
 * $HeadURL: svn://lvis10.fbm.fht-stuttgart.de/common/Common/src/de/hft_stuttgart/botwar/common/interfaces/IRemoteLogin.java $
 ******************************************************************************/
package de.hft_stuttgart.botwar.common.interfaces;

import de.hft_stuttgart.botwar.common.models.Password;
import de.hft_stuttgart.botwar.exceptions.RegistrationUnsuccessfulException;
import java.rmi.Remote;
import java.rmi.RemoteException;
import javax.security.auth.login.LoginException;

/**
 * This object is for the clients to log in.
 * @author c.a.duevel@gmail.com
 */
public interface IRemoteLogin extends Remote {

    /**
     * IRemotePlayer login.
     * @param userid The ID of the user
     * @param pwd Hashed PW of the user
     * @return <code>IRemotePlayer</code> object uniquely for this user
     * to start further interaction.
     * @throws java.rmi.RemoteException throws RemoteException
     * @throws LoginException If login was unsuccessful.
     * @deprecated please use login(String, Password) instead
     */
    @Deprecated
    IRemotePlayer login(String userid, String pwd)
            throws RemoteException, LoginException;

    /**
     * IRemotePlayer login.
     * @param userid The ID of the user
     * @param pwd Hashed PW of the user
     * @return <code>IRemotePlayer</code> object uniquely for this user
     * to start further interaction.
     * @throws java.rmi.RemoteException throws RemoteException
     * @throws LoginException If login was unsuccessful.
     */
    IRemotePlayer login(String userid, Password pwd)
            throws RemoteException, LoginException;

    /**
     * Registers a new user.
     * @param userid userid wanted
     * @param pwd the hashed password
     * @param email the email of the user
     * @throws java.rmi.RemoteException throws RemoteException
     * @throws hft_stuttgart.botwar.exceptions.RegistrationUnsuccessfulException
     * in case of unsuccessful Registration, because username is already taken
     * @throws IllegalArgumentException In case pwd or userid are too short (
     * at least 5 characters long), email has invalid form or any of the params
     * is <code>null</code>
     * @deprecated please use register(String, Password, String) instead
     */
    @Deprecated
    void register(String userid, String pwd, String email)
            throws RemoteException, RegistrationUnsuccessfulException;

        /**
     * Registers a new user.
     * @param userid userid wanted
     * @param pwd the hashed password
     * @param email the email of the user
     * @throws java.rmi.RemoteException throws RemoteException
     * @throws hft_stuttgart.botwar.exceptions.RegistrationUnsuccessfulException
     * in case of unsuccessful Registration, because username is already taken
     * @throws IllegalArgumentException In case pwd or userid are too short (
     * at least 5 characters long), email has invalid form or any of the params
     * is <code>null</code>
     */
    void register(String userid, Password pwd, String email)
            throws RemoteException, RegistrationUnsuccessfulException;
}
